package net.apexes.demo.codegen.dslite.qvar;

import java.math.BigDecimal;
import net.apexes.demo.codegen.dslite.entity.GoodsComboItemGroup;
import net.apexes.demo.codegen.dslite.qvar.base.QEntityBase;
import net.wafo.dslite.core.info.ForeignKey;
import net.wafo.dslite.core.info.Index;

import net.wafo.dslite.core.dsl.*;

/**
 * QGoodsComboItemGroup is a DSLite query type for GoodsComboItemGroup
 * @see GoodsComboItemGroup
 */
public class QGoodsComboItemGroup extends QEntityBase<GoodsComboItemGroup> {

    public static final QGoodsComboItemGroup $ = new QGoodsComboItemGroup("GOODS_COMBO_ITEM_GROUP");

    public final StringColumn name = varchar("NAME", 32).field("name").notNull().build();

    public final StringColumn goodsId = varchar("GOODS_ID", 22).field("goodsId").notNull().build();

    public final NumberColumn<BigDecimal> minQty = decimal("MIN_QTY", 12, 3).field("minQty").notNull().build();

    public final NumberColumn<BigDecimal> maxQty = decimal("MAX_QTY", 12, 3).field("maxQty").build();

    public final NumberColumn<Integer> seqOrder = integer("SEQ_ORDER").field("seqOrder").notNull().build();

    public final StringColumn templateId = varchar("TEMPLATE_ID", 22).field("templateId").notNull().build();

    public class Indexs {

        public final Index constraintIndexA9 = index("CONSTRAINT_INDEX_A9").column(goodsId).build();

        public final Index primaryKeyA96 = index("PRIMARY_KEY_A96").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public class ForeignKeys {

        public final ForeignKey constraintA965 = foreignKey(goodsId, "GOODS", "ID");

    }

    public final ForeignKeys fk = new ForeignKeys();

    public QGoodsComboItemGroup(String tableName) {
        super(GoodsComboItemGroup.class, tableName);
    }

    @Override
    public GoodsComboItemGroup newEntity() {
        return new GoodsComboItemGroup();
    }

    @Override
    public Object getFieldValue(GoodsComboItemGroup entity, String fieldName) {
        switch (fieldName) {
            case "name":
                return entity.getName();
            case "goodsId":
                return entity.getGoodsId();
            case "minQty":
                return entity.getMinQty();
            case "maxQty":
                return entity.getMaxQty();
            case "seqOrder":
                return entity.getSeqOrder();
            case "templateId":
                return entity.getTemplateId();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(GoodsComboItemGroup entity, String fieldName, Object value) {
        switch (fieldName) {
            case "name":
                entity.setName((java.lang.String) value);
                break;
            case "goodsId":
                entity.setGoodsId((java.lang.String) value);
                break;
            case "minQty":
                entity.setMinQty((java.math.BigDecimal) value);
                break;
            case "maxQty":
                entity.setMaxQty((java.math.BigDecimal) value);
                break;
            case "seqOrder":
                entity.setSeqOrder((java.lang.Integer) value);
                break;
            case "templateId":
                entity.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

